IF exists(SELECT * FROM dbo.sysobjects WHERE name='R_adviesFun' AND xtype='FN') 
BEGIN
	DROP FUNCTION R_adviesFun
END
GO

create function R_adviesFun
(@adviesCode varchar(7))
returns table
as
return
select adviesTekst from r_advies
where adviesCode=@adviesCode